package com.xshiwu.controller;

import com.xshiwu.service.ContentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@RestController
public class ContentController {

    @Resource
    private ContentService contentService;

    @GetMapping("/parseJd/{keywords}")
    public Boolean parseJd(@PathVariable("keywords") String keywords) throws IOException {
        return contentService.parseContent(keywords);
    }

    @GetMapping("/search")
    @CrossOrigin("*")
    public List<Map<String, Object>> search(@RequestParam String keywords, Integer page, Integer limit) throws IOException {
        if ("".equals(keywords)){
            return null;
        }
        return contentService.search(keywords, page, limit);
    }

}
